<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Unix)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGED" CONTENT="20101228;15221400">
	<STYLE TYPE="text/css">
	<!--
		@page { margin: 0.79in }
		P { margin-bottom: 0.08in }
		PRE { font-family: "Times New Roman" }
	-->
	</STYLE>
</HEAD>
<BODY LANG="el-GR" DIR="LTR">
<PRE LANG="en-US"><FONT SIZE=5><B>eferk</B></FONT>

<FONT SIZE=4><SPAN LANG="en-US">Solves an initial value problem, given as an autonomous system of first order ordinary differential equations by means of an exponentially fitted, semi-implicit Runge-Kutta method of third order.</SPAN></FONT>

<FONT SIZE=4><SPAN LANG="en-US"><B>Example: Can be run with F5 within the ScalaLab Editor (Ctrl-E to open the editor)</B></SPAN></FONT>
<FONT SIZE=3><SPAN LANG="en-US">import java.text.DecimalFormat;</SPAN></FONT>
<FONT SIZE=3><SPAN LANG="en-US">import numal.*;</SPAN></FONT>

<FONT SIZE=3><SPAN LANG="en-US">public class Test_eferk extends Object</SPAN></FONT>
                        <FONT SIZE=3><SPAN LANG="en-US">implements AP_eferk_methods {</SPAN></FONT>

  <FONT SIZE=3><SPAN LANG="en-US">static int passes,pasjac;</SPAN></FONT>
   
<FONT SIZE=3><SPAN LANG="en-US">	public static void main(String args[]) {</SPAN></FONT>

  <FONT SIZE=3><SPAN LANG="en-US">	int i;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	int k[] = new int[1];</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	double xe,phi,tol;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	double y[] = new double[3];</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	double j[][] = new double[3][3];</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	double x[] = new double[1];</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	double sigma[] = new double[1];</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	Test_eferk testeferk = new Test_eferk();</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	System.out.println(&quot;The results with EFERK are:\n\n&quot; +</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		&quot; K     DER.EV.  JAC.EV.    Y[1]           Y[2]&quot;);</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	phi=4.0*Math.atan(1.0);</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	tol=1.0;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	for (i=1; i&lt;=4; i++) {</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		passes=pasjac=0;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		x[0]=y[2]=0.0;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		y[1]=1.0;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		xe=50.0;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		Analytic_problems.eferk(x,xe,2,y,sigma,phi,testeferk,j,k,</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		                        1,true,tol,tol,1.0e-6,50.0,false);</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		tol *= 1.0e-1;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	}</SPAN></FONT>
<FONT SIZE=3><SPAN LANG="en-US">	}</SPAN></FONT>


  <FONT SIZE=3><SPAN LANG="en-US">public void derivative(int m, double y[])</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">{</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	double y1,y2;</SPAN></FONT>

  <FONT SIZE=3><SPAN LANG="en-US">	y1=y[1];</SPAN></FONT>
    <FONT SIZE=3><SPAN LANG="en-US">y2=y[2];</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	y[1]=(y1+0.99)*(y2-1.0)+0.99;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	y[2]=1000.0*((1.0+y1)*(1.0-y2)-1.0);</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	passes++;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">}</SPAN></FONT>


  <FONT SIZE=3><SPAN LANG="en-US">public void jacobian(int m, double j[][], double y[],</SPAN></FONT>
                       <FONT SIZE=3><SPAN LANG="en-US">double sigma[])</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">{</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	j[1][1]=y[2]-1.0;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	j[1][2]=0.99+y[1];</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	j[2][1]=1000.0*(1.0-y[2]);</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	j[2][2] = -1000.0*(1.0+y[1]);</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	sigma[0]=Math.abs(j[2][2]+j[1][1]-</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	         Math.sqrt((j[2][2]-j[1][1])*</SPAN></FONT>
<FONT SIZE=3><SPAN LANG="en-US">					   (j[2][2]-j[1][1])+4.0*j[2][1]*j[1][2]))/2.0;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	pasjac++;</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">}</SPAN></FONT>


  <FONT SIZE=3><SPAN LANG="en-US">public void output(double x[], double xe, int m, double y[],</SPAN></FONT>
                     <FONT SIZE=3><SPAN LANG="en-US">double j[][], int k[])</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">{</SPAN></FONT>
    <FONT SIZE=3><SPAN LANG="en-US">DecimalFormat fiveDigit = new DecimalFormat(&quot;0.00000E0&quot;);</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">	if (x[0] == 50.0)</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		System.out.println(&quot; &quot; + k[0] + &quot;\t&quot; + passes + &quot;\t&quot; +</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		  pasjac + &quot;\t&quot; + fiveDigit.format(y[1]) + &quot;\t&quot; +</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">		  fiveDigit.format(y[2]));</SPAN></FONT>
  <FONT SIZE=3><SPAN LANG="en-US">}</SPAN></FONT>
<FONT SIZE=3><SPAN LANG="en-US">}</SPAN></FONT></PRE>
</BODY>
</HTML>